<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this"><a href="{:url('AdminAsset/index')}">资源列表</a></li>
            </ul>
            <div class="layui-tab-content">
                <php>$status=['不可用', '可用'];</php>
                <table class="layui-table" lay-even="" lay-skin="nob" lay-size="lg">
                    <thead>
                    <tr>
                        <th width="50">ID</th>
                        <th>用户</th>
                        <th width="60">文件大小</th>
                        <th>文件名</th>
                        <th width="30">图像</th>
                        <th>文件路径</th>
                        <th width="100">状态</th>
                        <th width="50">{:lang('ACTIONS')}</th>
                    </tr>
                    </thead>
                    <tbody>
                    <php>
                        $asset_img_suffixes=['bmp','jpg','jpeg','png','gif','tiff'];/*TODO ADD MORE*/
                    </php>
                    <foreach name="assets" item="vo">
                        <tr>
                            <td>{$vo.id}</td>
                            <td>
                                用户ID:{$vo.user_id} {$vo.user_login} {$vo.user_nickname}
                            </td>
                            <td>{$vo.file_size/1024|round}KB</td>
                            <td>{$vo.filename}</td>
                            <td>
                                <if condition="in_array(strtolower($vo['suffix']),$asset_img_suffixes)">
                                    <a href="javascript:admin.imagePreviewDialog('{:cmf_get_image_preview_url($vo['file_path'])}');">
                                        <i class="icon-icon layui-icon-md-images"></i>
                                    </a>
                                </if>
                            </td>
                            <td>
                                <i class="icon-icon layui-icon-ios-albums"></i> {$vo.file_path}
                                <if condition="!file_exists('upload/'.$vo['file_path'])">
                                    <i class="icon-icon layui-icon-md-warning" style="color: #8b132c"> 文件丢失</i>
                                </if>
                            </td>
                            <td>{$status[$vo['status']]}</td>
                            <td>
                                <a class="layui-bo layui-bo-small layui-bo-close js-ajax-delete" href="{:url('AdminAsset/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
                <div class="pagination">{$page|default=''}</div>
            </div>
        </div>
    </div>
</div>
<include file="public@script"/>
</body>
</html>
